package com.dabbo.starship.cell;

import java.rmi.RemoteException;

import com.dabbo.starship.interfaces.Block;
import com.dabbo.starship.interfaces.Cell;

public class CellCargoTransporter extends CellDefault {

	private static final long serialVersionUID = 1901471945605737214L;

	public CellCargoTransporter(Block parent) throws RemoteException {
		super(parent);
		this.activated = false;
		this.cargoAllowed = true;
		this.cellType = Cell.CELL_CARGO;
		this.passable = true;
		this.powerOutput = 0;
		this.storageLimit = 300;
	}
	
	@Override
	public void activate() {
		System.out.println("CargoCell Activated");
		this.activated = true;
	}

	@Override
	public void deActivate() {
		this.activated = false;
		this.powerOutput = 0;
	}
	
	@Override
	public void tick() {
		// Slowly power-up transporter pad when activated.
		if (((Math.random() * 5) > 3) && this.powerOutput > -7 && this.activated) {
			this.powerOutput--;
		}
	}

	@Override
	public void powerFailue() {
		this.powerOutput = 0;
		this.activated = false;
	}


}
